﻿using M_Manufacture.API.Application.Command.WorkOrderCommand;
using M_Manufacture.Domain;
using M_Manufacture.Repository.Interface;
using MediatR;

namespace M_Manufacture.API.Application.CommandHandlers.WorkOrderCommandHandler
{
    /// <summary>
    /// 显示详情
    /// </summary>
    public class GetIdWorkOrderCommandHandler : IRequestHandler<GetIdWorkOrderCommand, WorkOrder>
    {

        private readonly IWorkOrderRepository _workOrderRepository;
        public GetIdWorkOrderCommandHandler(IWorkOrderRepository workOrderRepository)
        {
            _workOrderRepository = workOrderRepository;
        }
        public async Task<WorkOrder> Handle(GetIdWorkOrderCommand request, CancellationToken cancellationToken)
        {
            return await _workOrderRepository.GetModelsAsync(request.WorkOrderId);
        }
    }
}
